package br.cin.ufpe.corba.namingservice.binding;

import java.io.Serializable;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;

public class BindingList implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 5066759696319439606L;
	
	List<Binding> list;
	
	public BindingList(Set<Binding> bindings, int how_many) {
		list = new ArrayList<Binding>();
		list.addAll(bindings);
		if(list.size() > how_many) {
			list = list.subList(0, how_many);
		}
	}
	
	public BindingList(List<Binding> bindings) {
		this.list = bindings;
	}
	
	public BindingIterator iterator() {
		return new BindingIterator(this);
	}
	
	protected List<Binding> getInnerList() {
		return this.list;
	}
	
}
